package com.cooljie.service;

import com.cooljie.dao.CourseMapper;
import com.cooljie.entity.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by ACER on 2017/6/9.
 */
@Service("CourseService")
public class CourseServceImpl implements CourseService {
    @Autowired
    CourseMapper courseMapper;

    @Override
    public Course selectByCourseId(Integer id) {
        return courseMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Course> selectAllCourse() {
        return courseMapper.selectAllCourse();
    }

    @Override
    public int updateCourse(Course course) {
        return courseMapper.updateByPrimaryKeySelective(course);
    }

    @Override
    public int addCourse(Course course) {
        return courseMapper.insert(course);
    }

    @Override
    public int deleteCourse(Integer id) {
        return courseMapper.deleteByPrimaryKey(id);
    }
}
